#include <ESP8266WiFi.h>

static const char* host     = "10.240.1.131";
static const uint16_t port  = 3000;

const int N = 100;  // ESP8266 实际上最多 ≈4
static WiFiClient clients[N];

void sendTCP(){
  for(int i=0;i<N;i++){
    if(!clients[i] || !clients[i].connected()){
      if(clients[i].connect(host, port)){
        Serial.printf("Client %d connect sent\n", i);
      }
      clients[i].stop();  // 顺序关闭连接以释放 PCB（但并不是立即释放）
    }
  }
}
